<?php echo anchor(base_url(),"Home");?>
<?php echo validation_errors();?>
<?php echo form_open("role/Role/update");?>
<input type="hidden" name="id" id="id" value="<?php echo set_value('id', $role['id']);?>"/>
<input type="hidden" name="action" id="action" value="save"/>
<table>
  <tr>
    <td><label for="name">Role</label></td>
    <td><input type="text" name="name" id="name" value="<?php echo set_value('name', $role['name']);?>"/></td>
  </tr>
  <tr>
  	<td colspan="2">
  		<table>
  			<tr><td>Resource</td><td>Read</td><td>Write</td><td>Modify</td><td>Delete</td></tr>
  			<?php foreach ($perms as $perm) {
				  if($perm["resource"] == 4) {
			  
			?>
  			<tr>
  				<td>Catalog<input type="hidden" name="catalog_resource" value="1" />
  					<input type="hidden" name="perm_id" value="<?php echo set_value('perm_id', $perm['id']);?>" />
  				</td>
  				<td>
  				<?php 
  					  if($perm["read"] == 1) {
  					 	echo form_checkbox('catalog_perm[]', 'Read', TRUE);
					  } else {
						echo form_checkbox('catalog_perm[]', 'Read');
					  }?>
				</td>
				<td>
  				<?php 
  					  if($perm["write"] == 1) {
  					 	echo form_checkbox('catalog_perm[]', 'Write', TRUE);
					  } else {
						echo form_checkbox('catalog_perm[]', 'Write');
					  }?>
				</td>
				<td>
  				<?php 
  					  if($perm["modify"] == 1) {
  					 	echo form_checkbox('catalog_perm[]', 'Modify', TRUE);
					  } else {
						echo form_checkbox('catalog_perm[]', 'Modify');
					  }?>
				</td>
				<td>
  				<?php 
  					  if($perm["delete"] == 1) {
  					 	echo form_checkbox('catalog_perm[]', 'Delete', TRUE);
					  } else {
						echo form_checkbox('catalog_perm[]', 'Delete');
					  }?>
				</td>
  			</tr>
  			<?php
  			} 
  			}?>
  		</table>
  	</td>
  </tr>
  <tr>
  	<td><p><input type="submit" value="Update"/></td>
  	<td></td>
  </tr>
</table>
<?php echo form_close();?>